package com.letoken.platform.pub.annotation.sms;

/**
 * @Date 2021/1/18 16:57
 * @Created GG
 * @Description
 */
public enum VerifyCodeType {

    DEFAULT_UNUSED(0,"",false,"",300L,false,600L,5,600L),


    MALL_MERCHANT_SETTLE_IN(1,"mall_merchant_settle_in",false,"商城商户入驻",300L,false,600L,5,600L),

    MALL_MERCHANT_OLD(2,"mall_merchant_old",false,"商城商户修改手机号-旧号验证",300L,false,600L,5,600L),


    MALL_MERCHANT_NEW(3,"mall_merchant_new",false,"商城商户修改手机号-新号验证",300L,false,600L,5,600L),


    UNKNOWN(9999,"unknown",false,"",300L,true,600L,5,600L);

    private Integer type;
    private String name;
    // true 表示该业务需要用户已经注册
    private Boolean condition;
    private String msg;
    private Long timeOut;

    private Boolean needGraphics;

    // 时间窗口
    private Long timeWindow;

    //时间窗口内，超过错误次数限制使用
    private Integer errorCount;
    // 限制时间
    private Long limitTime;


    public static VerifyCodeType getInstance(Integer type){
        for (VerifyCodeType anEnum :  VerifyCodeType.values()) {
            if(anEnum.getType() == type){
                return anEnum;
            }
        }
        return  VerifyCodeType.UNKNOWN;
    }


    VerifyCodeType(Integer type, String name, Boolean condition, String msg, Long timeOut, Boolean needGraphics, Long timeWindow, Integer errorCount, Long limitTime) {
        this.type = type;
        this.name = name;
        this.condition = condition;
        this.msg = msg;
        this.timeOut = timeOut;
        this.needGraphics = needGraphics;
        this.timeWindow = timeWindow;
        this.errorCount = errorCount;
        this.limitTime = limitTime;
    }


    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Boolean getCondition() {
        return condition;
    }

    public void setCondition(Boolean condition) {
        this.condition = condition;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Long getTimeOut() {
        return timeOut;
    }

    public void setTimeOut(Long timeOut) {
        this.timeOut = timeOut;
    }

    public Boolean getNeedGraphics() {
        return needGraphics;
    }

    public void setNeedGraphics(Boolean needGraphics) {
        this.needGraphics = needGraphics;
    }

    public Long getTimeWindow() {
        return timeWindow;
    }

    public void setTimeWindow(Long timeWindow) {
        this.timeWindow = timeWindow;
    }

    public Integer getErrorCount() {
        return errorCount;
    }

    public void setErrorCount(Integer errorCount) {
        this.errorCount = errorCount;
    }

    public Long getLimitTime() {
        return limitTime;
    }

    public void setLimitTime(Long limitTime) {
        this.limitTime = limitTime;
    }
}

